/*
    Copyright (c) 2003-2016 Pentair Technical Products, Inc.
    All rights reserved.
    Pentair Technical Products, Inc. proprietary and confidential.

    Description:
	This module implements the checksum function.
    
    $Revision: 13617 $
*/

//#include <lib/lib.h>

/*
    The following function calculates the checksum
    of a given array of data.
*/
unsigned char checksum(const void *buf, unsigned long cb)
{
    unsigned char ret;

    for (ret = 0; cb; cb--, buf++) {
	ret += *(const unsigned char *)buf;
    }

    return ret;
}


